package simtools.wizard;

import java.awt.Color;
import java.awt.Font;
import java.awt.Rectangle;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.border.TitledBorder;


public class CdnPolicy extends JInternalFrame {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JPanel jPanel = null;

	private JRadioButton jRadioButton = null;

	private JRadioButton jRadioButton1 = null;

	private JRadioButton jRadioButton3 = null;

	private JButton jButton11 = null;

	public static CdnPolicy getInstance() {
		return CdnPolicyHolder.instance;
	}
	
	private static class CdnPolicyHolder {
        private static CdnPolicy instance = new CdnPolicy();
    }
	
	
	/**
	 * This is the default constructor
	 */
	public CdnPolicy() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setContentPane(getJContentPane());
		this.setTitle("CDN Policy");
		this.setIconifiable(false);
		this.setClosable(true);
		this.setSize(293, 183);
		this.setResizable(false);
		Wizard.centralize(this);
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	public JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getJPanel(), null);
			jContentPane.add(getJButton11(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel() {
		ButtonGroup cdnGroup = new ButtonGroup();
		if (jPanel == null) {
			jPanel = new JPanel();
			jPanel.setLayout(new BoxLayout(getJPanel(), BoxLayout.Y_AXIS));
			jPanel.setBorder(BorderFactory.createTitledBorder(null, "CDN Policy", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", Font.PLAIN, 11), new Color(0, 70, 213)));
			jPanel.setBounds(new Rectangle(15, 3, 253, 99));
			jPanel.add(getJRadioButton(), null);
			jPanel.add(getJRadioButton1(), null);
			jPanel.add(getJRadioButton3(), null);
			
			cdnGroup.add(getJRadioButton());
			cdnGroup.add(getJRadioButton1());
			cdnGroup.add(getJRadioButton3());
		}
		return jPanel;
	}

	/**
	 * This method initializes jRadioButton	
	 * 	
	 * @return javax.swing.JRadioButton	
	 */
	private JRadioButton getJRadioButton() {
		if (jRadioButton == null) {
			jRadioButton = new JRadioButton();
			jRadioButton.setSelected(true);
			jRadioButton.setActionCommand("Cooperative Environment (Closest Surrogate)");
			jRadioButton.setText("Cooperative push-based");
		}
		return jRadioButton;
	}

	/**
	 * This method initializes jRadioButton1	
	 * 	
	 * @return javax.swing.JRadioButton	
	 */
	private JRadioButton getJRadioButton1() {
		if (jRadioButton1 == null) {
			jRadioButton1 = new JRadioButton();
			jRadioButton1.setText("Non-cooperative pull-based ");
			jRadioButton1.setActionCommand("Non Cooperative Environment (Closest Origin)");
		}
		return jRadioButton1;
	}

	/**
	 * This method initializes jRadioButton3	
	 * 	
	 * @return javax.swing.JRadioButton	
	 */
	private JRadioButton getJRadioButton3() {
		if (jRadioButton3 == null) {
			jRadioButton3 = new JRadioButton();
			jRadioButton3.setText("Cooperative pull-based");
		}
		return jRadioButton3;
	}

	/**
	 * This method initializes jButton11	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton11() {
		if (jButton11 == null) {
			jButton11 = new JButton();
			jButton11.setText("Next >");
			jButton11.setBounds(new Rectangle(102, 114, 73, 26));
			jButton11.addActionListener(new java.awt.event.ActionListener() {   
				public void actionPerformed(java.awt.event.ActionEvent e) {    
					Wizard.jDesktopPane.removeAll();
					Wizard.jDesktopPane.repaint();
					
					Wizard.internal = NetworkTopology.getInstance();
					Wizard.jDesktopPane.add(Wizard.internal);
					Wizard.internal.setVisible(true);
				}
			
			});
		}
		return jButton11;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
